<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>lesson 14</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>

<body>
    <div id="root"></div>
</body>

</html>
<script>
    // 组件的定义：组件具有复用性，
    // 全局组件：在任何地方都可以使用
    const app = Vue.createApp({
        template: `
        <div>
           <counter-parent />
           <counter />
            <counter />
            <counter />
        </div>
        `
    });

    app.component('counter-parent', {
        template: `<counter />`
    });

    app.component('counter', {
        data() {
            return {
                count: 1,
            };
        },
        template: `
        <div>
            {{count}}
            <button @click="count++">+</button>
        </div>`
    });

    const vm = app.mount("#root")
</script>